package com.hexinfo.dmpro.sparing.controller;

import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import com.hexinfo.dmpro.sparing.model.TableSyncConf;
import com.hexinfo.dmpro.sparing.service.TableSyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


/**
 * 热备表级同步规则表
 *
 * @author zhou
 * @date 2024-04-26 10:16:47
 */
@RestController
@AllArgsConstructor
@RequestMapping("/api/tableSync" )
@Api(value = "tableSyncConf", tags = "热备表级同步规则表管理")
public class TableSyncController {

    private final TableSyncService tableSyncService;

    /**
     * 新增热备表级同步(源级)
     */
    @ApiOperation(value = "新增热备表级同步(源级)", notes = "新增热备表级同步(源级)")
    @GetMapping("/allTableSync" )
    @AnonymousAccess
    public ResponseEntity<Object> allTableSync(@Param("sourceName") String sourceName, @Param("rangeStartDate") String rangeStartDate, @Param("rangeEndDate") String rangeEndDate) {
        return ResponseEntity.ok(tableSyncService.tableSync(sourceName,rangeStartDate,rangeEndDate));
    }

}
